<?php
require_once 'application/services/VO/Country.php';
$my_class = new DatabaseWrapper();
$my_class->getCountries();


class DatabaseWrapper 
{
	
	
	/**
	 * Retrieve all the records from the table
	 * @return an array of VOAuthor
	 */
	public function getCountries() 
	{
		$DATABASE_SERVER = "91.121.56.68";
		$DATABASE_PASSWORD = "vub_wis";
		$DATABASE_USERNAME = "wis_developer";
		$DATABASE_NAME = "tours";
		
		//connect to the database.
		//we could have used an abstracting layer for connecting to the database.
		//for the sake of simplicity, I choose not to.
		$mysql = mysql_connect($DATABASE_SERVER, $DATABASE_USERNAME, $DATABASE_PASSWORD);
		mysql_select_db($DATABASE_NAME);
		//retrieve all rows
		$query = "SELECT * 
			  	   FROM country;
		$result = mysql_query($query);

		$ret = array();
		
	    while ($row = mysql_fetch_object($result, "Country")) 
	    {
			$ret[] = $row;
		}
		
		// free the memory used by the mysql handler
		mysql_free_result($result);
		// return the result
		return $ret;
	}
	
}
?>